package com.demo01.dao.impl;

import com.demo01.dao.User2Dao;
import com.demo01.pojo.User2;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@Repository("user2Dao")
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class User2DaoImpl implements User2Dao {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override
    public int insert(User2 user2) {
        int result = jdbcTemplate.update("INSERT INTO `User2` VALUES(?)", user2.getName());
        return result;
    }

    @Test
    public void test() {
        System.out.println(insert(new User2(1, "zhangsan")));

    }


}
